#!/bin/bash -eu

if grep -rq 'describe\.only' ./src
  then
    echo "describe.only found. Please update your test"
    exit 1
fi

if grep -rq 'it\.only' ./src
  then
    echo "it.only found. Please update your test"
    exit 1
fi

if grep -rq '\.\./client/' ./src/common
  then
    echo "'../client' reference found in common. Please update your code"
    exit 1
fi

if grep -rq '\.\./server/' ./src/common
  then
    echo "'../server' reference found in common. Please update your code"
    exit 1
fi

if grep -rq 'fsevents' ./npm-shrinkwrap.json
  then
    echo "'fsevents' reference found in npm-shrinkwrap.json. Please fix"
    exit 1
fi

export DO_LIB_CHECK=1
gulp all

node_modules/.bin/mocha \
  build/**/*.mocha.js \
  test/basic \
  test/simulate \
  ;
